const yes_Selected1= document.querySelector('.one .yes')
const no_Selected1 = document.querySelector('.one .no')
no_Selected1.addEventListener("touchstart",function() {
    yes_Selected1.children[0].src = "./image/rediobtn_nor.png"
    no_Selected1.children[0].src = "./image/rediobtn_sel.png"
})
yes_Selected1.addEventListener("touchstart",function() {
    yes_Selected1.children[0].src = "./image/rediobtn_sel.png"
    no_Selected1.children[0].src = "./image/rediobtn_nor.png"
})
const yes_Selected2= document.querySelector('.two .yes')
const no_Selected2 = document.querySelector('.two .no')
no_Selected2.addEventListener("touchstart",function() {
    yes_Selected2.children[0].src = "./image/rediobtn_nor.png"
    no_Selected2.children[0].src = "./image/rediobtn_sel.png"
})
yes_Selected2.addEventListener("touchstart",function() {
    yes_Selected2.children[0].src = "./image/rediobtn_sel.png"
    no_Selected2.children[0].src = "./image/rediobtn_nor.png"
})
const yes_Selected3= document.querySelector('.three .yes')
const no_Selected3 = document.querySelector('.three .no')
no_Selected3.addEventListener("touchstart",function() {
    yes_Selected3.children[0].src = "./image/rediobtn_nor.png"
    no_Selected3.children[0].src = "./image/rediobtn_sel.png"
})
yes_Selected3.addEventListener("touchstart",function() {
    yes_Selected3.children[0].src = "./image/rediobtn_sel.png"
    no_Selected3.children[0].src = "./image/rediobtn_nor.png"
})
//   异常时间事件
const abnormal = document.querySelector(".content1 .times .right");
// 获取时间
$("#kinerDatePickerInput1").kinerDatePicker({
    clickMaskHide: true,
    showHandler: function (ctx) {
      // console.log("显示时间选择器:", ctx);
    },
    hideHandler: function (ctx) {
      // console.log("隐藏时间选择器:", ctx);
    },
    changeHandler: function (vals, ctx) {
      // console.log("时间改变:", vals, ctx);
    },
    okHandler: function (vals, ctx) {
      // console.log("确定选择:", vals, ctx);
    },
    cancelHandler: function (ctx) {
      // console.log("取消选择:", ctx);
    },
  });
  $("#btn1").click(function () {
    // console.log($("#kinerDatePickerInput1").kinerDatePickerVal());
  });
  $("#kinerDatePickerInput2").kinerDatePicker({
    clickMaskHide: true,
    showHandler: function (ctx) {
      // console.log("显示时间选择器:", ctx);
    },
    hideHandler: function (ctx) {
      // console.log("隐藏时间选择器:", ctx);
    },
    changeHandler: function (vals, ctx) {
      // console.log("时间改变:", vals, ctx);
    },
    okHandler: function (vals, ctx) {
      // console.log("确定选择:", vals, ctx);
    },
    cancelHandler: function (ctx) {
      // console.log("取消选择:", ctx);
    },
  });

  $("#btn2").click(function () {
    // console.log($("#kinerDatePickerInput2").kinerDatePickerVal());
  });
  // 绑定时间点击事件
  const abnormalTimes = document.querySelector(".time .back span ");
  const contentTime = document.querySelector(".time .abnormalTime .cotent");
  // 时间值
  const kinerDatePickerInput = document.querySelector(
    ".time .abnormalTime .kinerDatePickerInput"
  );
  const btnCancel = document.querySelector(".time .abnormalTime .Cancel");
  const btnconfirm = document.querySelector(".time .abnormalTime .confirm");
  let flagTime = false;
  let flagscroll = false;
  //获取时间
  let datatime = "";

  abnormalTimes.addEventListener("click", function () {
    flagTime = true;
    if (flagTime) {
      flagscroll = true;
      abnormalTimes.style.opacity = "0";
      contentTime.style.display = "block";
    }
  });

  // 点击取消选择
  btnCancel.addEventListener("click", function () {
    if (flagTime) {
      flagscroll = false;
      kinerDatePickerInput.innerText = "请选择时间";
      abnormalTimes.style.opacity = "1";
      contentTime.style.display = "none";
    }
  });
  const dataAbn = { times: "", address: "", type: "", datail: "" };
  // 点击确认选择
  btnconfirm.addEventListener("click", function () {
    datatime = kinerDatePickerInput.innerText + "  13:00";
    abnormalTimes.style.opacity = "1";
    contentTime.style.display = "none";
    abnormalTimes.innerText = datatime;
    dataAbn.times = datatime;
  });
  dataAbn.address = "浙江省 杭州市 钱塘区";
  //监视页面滑动
  const content1 = document.querySelector(".content1");
  window.addEventListener("scroll", function () {
    const top = this.document.documentElement.scrollTop;
    // console.log(top);
    if (flagscroll) {
      if (top > content1.offsetTop) {
        abnormalTimes.style.opacity = "1";
        contentTime.style.display = "none";
      } else {
        abnormalTimes.style.opacity = "0";
        contentTime.style.display = "block";
      }
    } else return;
  });
